﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ketnoidulieu
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        
        OleDbConnection c=new OleDbConnection();

        void ketnoi()
        {
            c.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=QLDiem.mdb";
            if (c.State == ConnectionState.Closed)
                c.Open();
        }

        DataSet laydulieu()
        {
            DataSet d = new DataSet();
            OleDbDataAdapter da = new OleDbDataAdapter("select * from SinhVien", c);
            da.Fill(d, "SinhVien");
            return d;
        }

        private void btnaccess_Click(object sender, EventArgs e)
        {
            ketnoi();
            DataSet d = laydulieu();
            dgv1.DataSource = d.Tables[0];
        }
    }
}
